import { reactive } from "vue";
import Comment from "./comment";
export let bombArr2 = reactive([]); //炸弹数组  装position值

export default class Bomb {
  // 炸弹
  constructor(zdImg = Comment.zdImg, bombImg = Comment.bombImg) {
    this.zdImg = zdImg;
    this.bombImg = bombImg;
  }
  create(msgData) {
    let pObj = document.createElement("img");
    let X = msgData.bomb.x - Comment.blockSize / 2;
    let Y = msgData.bomb.y - Comment.blockSize / 2;
    bombArr2.push([X, Y]);

    pObj.setAttribute("id", `zd-${msgData.bomb.cellNo}`);
    pObj.setAttribute("src", this.zdImg);
    pObj.style.position = "absolute";
    // 跟人物差不多
    pObj.style.left = X + "px";
    pObj.style.top = Y + "px";
    pObj.style.width = Comment.blockSize + "px";
    pObj.style.height = Comment.blockSize + "px";
    document.getElementById("box").appendChild(pObj);

    return msgData.bomb.cellNo;
  }
}
